<?php

class Sifat_surat{
	private $id;
	private $sifat;
	
	function __construct(){}
	
	function setId($id){
		$this->id = $id;
	}
	
	function setSifat($sifat){
		$this->sifat = $sifat;
	}
	
	function getId(){
		return $this->id;
	}
	
	function getSifat(){
		return $this->sifat;
	}

}


class Daftar_sifat_surat{

	function __construct(){}
	
	function getAll(){
		
		$sql="
		select *
		from
		sifat_surat
		";
		
		$list_sifat = array();
		
		$data = mysql_query($sql);
		if($data){
			while($row = mysql_fetch_assoc($data)){
			
				$sifat = new Sifat_surat();
				$sifat->setId($row['kd_sifat_surat']);
				$sifat->setSifat($row['sifat_surat']);
								
				$list_sifat[] = $sifat;
			}
		}	
		return $list_sifat;
	}
	
	function getById($id){
		
		$sql="
		select *
		from
		sifat_surat
		where kd_sifat_surat = '$id'
		";
		
		
		$data = mysql_query($sql);
		if($data){
			while($row = mysql_fetch_assoc($data)){
			
				$sifat = new Sifat_surat();
				$sifat->setId($row['kd_sifat_surat']);
				$sifat->setSifat($row['sifat_surat']);
			
			}
		}	
		return $sifat;
	}
}